package com.ddn.controller.person;

import com.ddn.model.personnel.Empl;
import com.ddn.service.personnel.EmplService;
import com.ddn.util.ResultData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * @author Bikakaso
 * @date 2022/12/30
 * ddn_hotel
 * 人事管理
 */
@RestController
@RequestMapping("/per")
public class EmplController {
    @Autowired
    private EmplService emplService;

    // 员工
    // 查询全部&&模糊查询
    @RequestMapping("/list")
    public ResultData findAll(@RequestParam HashMap<String,Object> map) {
       ResultData data = emplService.findAll(map);
        System.out.println("map = " + map);
        return data;
    }
    // 删除
    @RequestMapping("/delete")
    public ResultData deleteById(int id) {
        ResultData data = emplService.deleteById(id);
        return data;
    }
    // 批量删除
    @RequestMapping("/deleteBatch")
    public ResultData deleteBatch(int[] ids) {
//        System.out.println(Arrays.toString(ids));
        ResultData data = emplService.deleteBatch(ids);
        return data;
    }
    // 添加
    @RequestMapping("/add")
    public ResultData add(Empl empl) {
        System.out.println("empl = " + empl);
        ResultData data = emplService.add(empl);
        return data;
    }
    @RequestMapping("/edit")
    public ResultData edit(Empl empl) {
        System.out.println("empl = " + empl);
        ResultData data = emplService.edit(empl);
        return data;
    }


}
